//
//  MyViewInit.m
//  Unity-iPhone
//
//  Created by wencun on 4/3/15.
//
//

#import "MyViewInit.h"
#import "UnityInterface.h"

@implementation MyViewInit

+ (void) enabled{
    UnitySendMessage("Cube", "Enabled", "");
}

+ (void) disabled{
    UnitySendMessage("Cube", "Disabled", "");
}

+ (void) setEnabled:(NSString *)foo{
    UnitySendMessage("Cube", "SetText", [foo UTF8String]);
}

+ (int) value{
//    return UnitySendMessage("Cube", "returnVal", "");
    return 11;
}

@end

#pragma mark cplusplus code
extern "C"{
    int ActivateUI_iOS(int index){
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Unity调用了IOS方法" message:[NSString stringWithFormat:@"我是第%i次从Unity过来的！",index] delegate:nil cancelButtonTitle:@"取消" otherButtonTitles:nil, nil];
        [alert show];
//        NSString *s = [NSString stringWithCharacters:index length:99];
//        NSNumber *num = [NSNumber numberWithChar:index];
        return ++index;
    }
}

